package com.example.rxjava1;

import rx.Observable;
import rx.Observer;

import java.util.Arrays;

public class RxJava1Test01 {
    public static void main(String[] args) throws InterruptedException {
        Observable<String> observable=Observable.from(Arrays.asList("www",".","w3cschool",".","com"));

        observable.subscribe(new Observer<String>() {
            @Override
            public void onCompleted() {
                System.out.println("数据处理完成");
            }

            @Override
            public void onError(Throwable throwable) {
                System.out.println("异常");
            }

            @Override
            public void onNext(String s) {
                System.out.println("接收到 observable的数据，处理数据："+s);
            }
        });

        Thread.currentThread().join();
    }
}
